package cn.leida.ruoyi.system.domain;

import cn.leida.ruoyi.common.core.domain.BaseEntity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;

/**
 * 通知公告表 sys_notice
 *
 * @author liutietou
 * @since 1.0  2020-12-11
 */
@Data
@Entity
@Table(name = "sys_notice")
public class SysNotice extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 公告ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "notice_id")
    private Long noticeId;

    /**
     * 公告标题
     */
    @NotBlank(message = "公告标题不能为空")
    @Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
    @Column(name = "notice_title",length = 100)
    private String noticeTitle;

    /**
     * 公告类型（1通知 2公告）
     */
    @Column(name = "notice_type",length = 10)
    private String noticeType;

    /**
     * 公告内容
     */
    @Column(name = "notice_content",length = 2000)
    private String noticeContent;

    /**
     * 公告状态（0正常 1关闭）
     */
    @Column(name = "status",length = 10)
    private String status;
    /**
     * 创建者
     */
    @Column(name = "create_by",length = 64)
    private String createBy;

    /**
     * 创建时间
     */
    @Column(name = "create_time",length = 30)
    private String createTime;

    /**
     * 更新者
     */
    @Column(name = "update_by",length = 64)
    private String updateBy;

    /**
     * 更新时间
     */
    @Column(name = "update_time",length = 30)
    private String updateTime;

    /**
     * 备注
     */
    @Column(name = "remark",length = 500)
    private String remark;

    public void initUpdateTime(){
        updateTime = nowTime();
    }
    public void initCreateTime(){
        createTime = nowTime();
    }
}

